/**
 */
package org.mro.grib.model.files.secondEdition.grids.impl;

import java.nio.ByteBuffer;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.mro.grib.model.files.secondEdition.grids.GridDefinitionTemplate350;
import org.mro.grib.model.files.secondEdition.grids.GridsPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Grid Definition Template350</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.mro.grib.model.files.secondEdition.grids.impl.GridDefinitionTemplate350Impl#getJPentagonalResolutionParameter <em>JPentagonal Resolution Parameter</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.grids.impl.GridDefinitionTemplate350Impl#getKPentagonalResolutionParameter <em>KPentagonal Resolution Parameter</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.grids.impl.GridDefinitionTemplate350Impl#getMPentagonalResolutionParameter <em>MPentagonal Resolution Parameter</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.grids.impl.GridDefinitionTemplate350Impl#getRepresentationType <em>Representation Type</em>}</li>
 *   <li>{@link org.mro.grib.model.files.secondEdition.grids.impl.GridDefinitionTemplate350Impl#getRepresentationMode <em>Representation Mode</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class GridDefinitionTemplate350Impl extends EObjectImpl implements GridDefinitionTemplate350 {
	/**
	 * The default value of the '{@link #getJPentagonalResolutionParameter() <em>JPentagonal Resolution Parameter</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getJPentagonalResolutionParameter()
	 * @generated
	 * @ordered
	 */
	protected static final int JPENTAGONAL_RESOLUTION_PARAMETER_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getJPentagonalResolutionParameter() <em>JPentagonal Resolution Parameter</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getJPentagonalResolutionParameter()
	 * @generated
	 * @ordered
	 */
	protected int jPentagonalResolutionParameter = JPENTAGONAL_RESOLUTION_PARAMETER_EDEFAULT;

	/**
	 * The default value of the '{@link #getKPentagonalResolutionParameter() <em>KPentagonal Resolution Parameter</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getKPentagonalResolutionParameter()
	 * @generated
	 * @ordered
	 */
	protected static final int KPENTAGONAL_RESOLUTION_PARAMETER_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getKPentagonalResolutionParameter() <em>KPentagonal Resolution Parameter</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getKPentagonalResolutionParameter()
	 * @generated
	 * @ordered
	 */
	protected int kPentagonalResolutionParameter = KPENTAGONAL_RESOLUTION_PARAMETER_EDEFAULT;

	/**
	 * The default value of the '{@link #getMPentagonalResolutionParameter() <em>MPentagonal Resolution Parameter</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMPentagonalResolutionParameter()
	 * @generated
	 * @ordered
	 */
	protected static final int MPENTAGONAL_RESOLUTION_PARAMETER_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getMPentagonalResolutionParameter() <em>MPentagonal Resolution Parameter</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMPentagonalResolutionParameter()
	 * @generated
	 * @ordered
	 */
	protected int mPentagonalResolutionParameter = MPENTAGONAL_RESOLUTION_PARAMETER_EDEFAULT;

	/**
	 * The default value of the '{@link #getRepresentationType() <em>Representation Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRepresentationType()
	 * @generated
	 * @ordered
	 */
	protected static final byte REPRESENTATION_TYPE_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getRepresentationType() <em>Representation Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRepresentationType()
	 * @generated
	 * @ordered
	 */
	protected byte representationType = REPRESENTATION_TYPE_EDEFAULT;

	/**
	 * The default value of the '{@link #getRepresentationMode() <em>Representation Mode</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRepresentationMode()
	 * @generated
	 * @ordered
	 */
	protected static final byte REPRESENTATION_MODE_EDEFAULT = 0x00;

	/**
	 * The cached value of the '{@link #getRepresentationMode() <em>Representation Mode</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRepresentationMode()
	 * @generated
	 * @ordered
	 */
	protected byte representationMode = REPRESENTATION_MODE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected GridDefinitionTemplate350Impl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return GridsPackage.Literals.GRID_DEFINITION_TEMPLATE350;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getJPentagonalResolutionParameter() {
		return jPentagonalResolutionParameter;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setJPentagonalResolutionParameter(int newJPentagonalResolutionParameter) {
		int oldJPentagonalResolutionParameter = jPentagonalResolutionParameter;
		jPentagonalResolutionParameter = newJPentagonalResolutionParameter;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GridsPackage.GRID_DEFINITION_TEMPLATE350__JPENTAGONAL_RESOLUTION_PARAMETER, oldJPentagonalResolutionParameter, jPentagonalResolutionParameter));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getKPentagonalResolutionParameter() {
		return kPentagonalResolutionParameter;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setKPentagonalResolutionParameter(int newKPentagonalResolutionParameter) {
		int oldKPentagonalResolutionParameter = kPentagonalResolutionParameter;
		kPentagonalResolutionParameter = newKPentagonalResolutionParameter;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GridsPackage.GRID_DEFINITION_TEMPLATE350__KPENTAGONAL_RESOLUTION_PARAMETER, oldKPentagonalResolutionParameter, kPentagonalResolutionParameter));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getMPentagonalResolutionParameter() {
		return mPentagonalResolutionParameter;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMPentagonalResolutionParameter(int newMPentagonalResolutionParameter) {
		int oldMPentagonalResolutionParameter = mPentagonalResolutionParameter;
		mPentagonalResolutionParameter = newMPentagonalResolutionParameter;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GridsPackage.GRID_DEFINITION_TEMPLATE350__MPENTAGONAL_RESOLUTION_PARAMETER, oldMPentagonalResolutionParameter, mPentagonalResolutionParameter));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getRepresentationType() {
		return representationType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRepresentationType(byte newRepresentationType) {
		byte oldRepresentationType = representationType;
		representationType = newRepresentationType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GridsPackage.GRID_DEFINITION_TEMPLATE350__REPRESENTATION_TYPE, oldRepresentationType, representationType));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public byte getRepresentationMode() {
		return representationMode;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRepresentationMode(byte newRepresentationMode) {
		byte oldRepresentationMode = representationMode;
		representationMode = newRepresentationMode;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GridsPackage.GRID_DEFINITION_TEMPLATE350__REPRESENTATION_MODE, oldRepresentationMode, representationMode));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__JPENTAGONAL_RESOLUTION_PARAMETER:
				return getJPentagonalResolutionParameter();
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__KPENTAGONAL_RESOLUTION_PARAMETER:
				return getKPentagonalResolutionParameter();
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__MPENTAGONAL_RESOLUTION_PARAMETER:
				return getMPentagonalResolutionParameter();
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__REPRESENTATION_TYPE:
				return getRepresentationType();
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__REPRESENTATION_MODE:
				return getRepresentationMode();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__JPENTAGONAL_RESOLUTION_PARAMETER:
				setJPentagonalResolutionParameter((Integer)newValue);
				return;
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__KPENTAGONAL_RESOLUTION_PARAMETER:
				setKPentagonalResolutionParameter((Integer)newValue);
				return;
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__MPENTAGONAL_RESOLUTION_PARAMETER:
				setMPentagonalResolutionParameter((Integer)newValue);
				return;
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__REPRESENTATION_TYPE:
				setRepresentationType((Byte)newValue);
				return;
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__REPRESENTATION_MODE:
				setRepresentationMode((Byte)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__JPENTAGONAL_RESOLUTION_PARAMETER:
				setJPentagonalResolutionParameter(JPENTAGONAL_RESOLUTION_PARAMETER_EDEFAULT);
				return;
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__KPENTAGONAL_RESOLUTION_PARAMETER:
				setKPentagonalResolutionParameter(KPENTAGONAL_RESOLUTION_PARAMETER_EDEFAULT);
				return;
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__MPENTAGONAL_RESOLUTION_PARAMETER:
				setMPentagonalResolutionParameter(MPENTAGONAL_RESOLUTION_PARAMETER_EDEFAULT);
				return;
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__REPRESENTATION_TYPE:
				setRepresentationType(REPRESENTATION_TYPE_EDEFAULT);
				return;
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__REPRESENTATION_MODE:
				setRepresentationMode(REPRESENTATION_MODE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__JPENTAGONAL_RESOLUTION_PARAMETER:
				return jPentagonalResolutionParameter != JPENTAGONAL_RESOLUTION_PARAMETER_EDEFAULT;
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__KPENTAGONAL_RESOLUTION_PARAMETER:
				return kPentagonalResolutionParameter != KPENTAGONAL_RESOLUTION_PARAMETER_EDEFAULT;
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__MPENTAGONAL_RESOLUTION_PARAMETER:
				return mPentagonalResolutionParameter != MPENTAGONAL_RESOLUTION_PARAMETER_EDEFAULT;
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__REPRESENTATION_TYPE:
				return representationType != REPRESENTATION_TYPE_EDEFAULT;
			case GridsPackage.GRID_DEFINITION_TEMPLATE350__REPRESENTATION_MODE:
				return representationMode != REPRESENTATION_MODE_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (jPentagonalResolutionParameter: "); //$NON-NLS-1$
		result.append(jPentagonalResolutionParameter);
		result.append(", kPentagonalResolutionParameter: "); //$NON-NLS-1$
		result.append(kPentagonalResolutionParameter);
		result.append(", mPentagonalResolutionParameter: "); //$NON-NLS-1$
		result.append(mPentagonalResolutionParameter);
		result.append(", representationType: "); //$NON-NLS-1$
		result.append(representationType);
		result.append(", representationMode: "); //$NON-NLS-1$
		result.append(representationMode);
		result.append(')');
		return result.toString();
	}

	/* (non-Javadoc)
	 * @see org.mro.grib.model.files.secondEdition.grids.IGridDefinition#initialise(java.nio.ByteBuffer)
	 */
	@Override
	public void initialise(ByteBuffer buffer) {
		jPentagonalResolutionParameter = buffer.getInt();
		kPentagonalResolutionParameter = buffer.getInt();
		mPentagonalResolutionParameter = buffer.getInt();
		representationType = buffer.get();
		representationMode = buffer.get();
	}
	
} //GridDefinitionTemplate350Impl
